//公用样式 
// require('../../assets/css/index.less')

require('../../assets/css/index.less')
require('../../assets/fonts/iconfont.css')
//引入weui库
require('../../assets/lib/weui/weui.css');
let weui = require('../../assets/lib/weui/weui.js');
// 当前页面样式
require('./introduction.less')
//工具函数 utils
const dom = require('../../utils/dom');
const local = require('../../utils/local.js');
//引入axios封装的文件
let https = require('../../utils/https.js');
//DOM加载事件
dom.ready(function () {
    //调用底部菜单
    dom.bMenu('circle')

function getCourseList(){
    https.get('/api/train/courseList',function(res){
        let {errno,data} = res;
        if (errno == 0) {
            //分数据---最新课程和课程的数据
            data.map((v, i) => {
                console.log(v, i);
                if (i == 0) {
                    rander('#newCourse', v)
                } else {
                    rander('#course', v)
                }
            })
        }
    })
}
getCourseList()   
function rander(obj, data) {
    console.log(obj, data);
        dom.getEle(obj).innerHTML += `<li class="curriculum">
        <a href="course-description.html?id=${data.courseId}">
          <img src="${https.BASE_URL + data.imgurl}" alt="">
          <div class="plf5">
            <h2>${data.name}</h2>
            <p>${data.desc}</p>
          </div>
        </a>
      </li>`
    }
})
